package org.wmq.positiontoshop.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.wmq.positiontoshop.common.LocalCache;

@Service
public class UserListener {
    @Autowired
    private LocalCache localCache;

    @KafkaListener(topics = {"user.update","user.delete"}, groupId = "user-group")
    public void handleUserUpdateAndDelete(String key) {
        this.localCache.remove(key);
    }
}
